<!DOCTYPE html>
<html lang="zh_CN">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<p>
    https://www.w3school.com.cn/jsref/jsref_obj_math.asp

</p>
</body>
<script type="text/javascript">
    var a = 12;
    var b = -123;

    // 获取变量的绝对值
    // |-12| = 12
    // |23| = 23

    /*function abs(x){
        return  x > 0 ? x : -x;
    }*/

    console.log(Math.abs(a));
    console.log(Math.abs(b));

</script>

</html>
